<?php

	class Curl {

		private static $ch;

		public static function get($url) {
			self::$ch = curl_init($url);
			curl_setopt_array(self::$ch, array(
				CURLOPT_RETURNTRANSFER => true,
				CURLOPT_FOLLOWLOCATION => true,
				CURLOPT_USERAGENT      => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
				CURLOPT_COOKIEFILE     => TEMP_PATH . '/cookie',
				CURLOPT_COOKIEJAR      => TEMP_PATH . '/cookie',
			));

			$result = curl_exec(self::$ch);
			if ($error_code = curl_errno(self::$ch)) {
				throw new CurlException(curl_error(self::$ch), $error_code);
			}

			return $result;
		}
	}

	class CurlException extends AppException {

	}